<template>
    <div class="component component--layout">
        <header class="header" v-if="props.emerTitle">
            <p class="paragraph">
                {{ props.emerTitle }}
            </p>
        </header>
        <div class="column column--primary">
            <div class="element element--article" v-for="(v, i) in props.nationlrData" :key="i">
                <figure class="article__figure">
                    <a class="figure__image disableShadowBox">
                        <img class="lazyautosizes lazyloaded" sizes="277px" :srcset="v.src">
                    </a>
                </figure>
                <div class="article__content">
                    <p class="artline">
                        {{ v.cont }}
                    </p>
                    <p class="article__summary">{{ v.symbol }}</p>
                    <div class="content--secondary">
                        <div class="group group--tickers">
                            <bg-quote :class="[it.value < 0 ? 'negative' : 'positive']" v-for="(it, idx) in v.data"
                                :key="idx">
                                <a class="ticker">
                                    <span class="ticker__symbol">{{ it.name }}</span>
                                    <bg-quote class="ticker__change">{{ it.value }}%</bg-quote>
                                    <i class="icon"></i>
                                </a>
                            </bg-quote>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="column column--aside">
            <div class="element element--article" v-for="(item, idx) in props.nationRightData" :key="idx">
                <div class="article__figure">
                    <a class="figure__image">
                        <img class="lazyautosizes" :src="item.src">
                    </a>
                </div>
                <div class="article__content">
                    <h3 class="article__headline">
                        <a class="link">
                            {{ item.title }}
                        </a>
                    </h3>
                    <div class="content--secondary">
                        <div class="group group--tickers">
                            <bg-quote :class="[it.value < 0 ? 'negative' : 'positive']" v-for="(it, idx) in item.data"
                                :key="idx">
                                <a class="ticker">
                                    <span class="ticker__symbol">{{ it.name }}</span>
                                    <bg-quote class="ticker__change">{{ it.value }}%</bg-quote>
                                    <i class="icon"></i>
                                </a>
                            </bg-quote>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
<script setup>
const props = defineProps(['nationlrData', 'emerTitle', 'nationRightData'])
</script>
<style scoped lang='scss'>
.column--primary {
    max-width: 640px;
}

.element--article {
    box-shadow: 0 -1px 0 0 #e1e1e1, inset 0 -1px 0 0 #e1e1e1;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-flex-flow: row nowrap;
    -ms-flex-flow: row nowrap;
    flex-flow: row nowrap;
    margin: 0;
    padding: 10px 0;
}

.column--aside {
    max-width: 320px;

    .article__content {
        display: -webkit-flex;
        display: -ms-flexbox;
        display: flex;
        -webkit-flex-flow: column nowrap;
        -ms-flex-flow: column nowrap;
        flex-flow: column nowrap;
        -webkit-flex: 1;
        -ms-flex: 1;
        flex: 1;
        margin: 0;
    }

    .article__figure {
        max-width: 120px;
        margin-right: 10px;
        position: relative;
        width: 100%;
    }
}

@media (min-width: 1296px) {
    .article__figure {
        margin-right: 10px;
    }

    .artline {
        font-size: 1.5rem;
        padding: 0;
        font-weight: bold;
        line-height: 1.125;
    }
}
</style>